package control;

import java.util.Scanner;

public class StructureControl {

    private static Scanner scanner;

    public static void sequenceControl() {
        System.out.println("输入内容:");
        String str = scanner.next();
        System.out.println(str);
    }

    public static void selectControl() {
        System.out.println("输入内容:");
        String str = scanner.next();

        if("Hello!".equals(str)) {
            System.out.println(str);
        }else {
            System.out.println("See you!");
        }
    }

    public static void switchControl() {
        char grade = 'C';
        //case穿透
        switch (grade) {
            case 'A':
                System.out.println("优秀");
                break;
            case 'B':
                System.out.println("良好");
                break;
            case 'C':
                System.out.println("及格");
                break;
            default:
                System.out.println("再接再厉");
        }

        String name = "Lby";
        //JDK7后，表达式结果可以是字符串
        //字符的本质还是数字

        //反编译 java-(编译)->class(字节码文件)-(IDEA反编译)->
        switch (name) {
            case "Lby":
                System.out.println("你是Lby");
                break;
            case "Cph":
                System.out.println("你是Cph");
                break;
            default:
                System.out.println("弄啥嘞");
        }
    }

    public static void main(String[] args) {
        scanner = new Scanner(System.in);

        sequenceControl();
        selectControl();
        switchControl();

        scanner.close();
    }
}
